package com.zc.util;

import java.util.List;

public class ContactsBean {
	public String id;
	public String name;
	public String phones;
	public String emails;
	public String notes;
	public List<CAddress> addresses;
	public String nicknames;
	public String websites;
	public List<CCompany> companies;
	
	public String getId() {
		return id;
	}
	public void setId(String contactId) {
		this.id = contactId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public List<CAddress> getAddresses() {
		return addresses;
	}
	public void setAddresses(List<CAddress> addresses) {
		this.addresses = addresses;
	}
	public List<CCompany> getCompanies() {
		return companies;
	}
	public void setCompanies(List<CCompany> companies) {
		this.companies = companies;
	}
	
	public String getPhones() {
		return phones;
	}
	public void setPhones(String phones) {
		this.phones = phones;
	}
	public String getEmails() {
		return emails;
	}
	public void setEmails(String emails) {
		this.emails = emails;
	}
	public String getNotes() {
		return notes;
	}
	public void setNotes(String notes) {
		this.notes = notes;
	}
	public String getNicknames() {
		return nicknames;
	}
	public void setNicknames(String nicknames) {
		this.nicknames = nicknames;
	}
	public String getWebsites() {
		return websites;
	}
	public void setWebsites(String websites) {
		this.websites = websites;
	}
	public String beanToString(){
		StringBuilder sb = new StringBuilder();
		sb.append("-->>");
		sb.append("name:"+((name !=null && name.length()>0)?name:" "));
		sb.append(";");
		if(phones!=null && phones.length() > 0){
			sb.append("phone:"+phones);
		}else{
			sb.append("phone:"+" ");
		}
		sb.append(";");
		if(emails!=null && emails.length() > 0){
			sb.append("emails:"+emails);
		}else{
			sb.append("email:"+" ");
		}
		sb.append(";");
		if(notes!=null && notes.length() > 0){
			sb.append("notes:"+notes);
		}else{
			sb.append("note:"+" ");
		}
		sb.append(";");
		if(nicknames!=null && nicknames.length() > 0){
			sb.append("nicknames:"+nicknames);
		}else{
			sb.append("nickname:"+" ");
		}
		sb.append(";");
		if(websites!=null && websites.length() > 0){
			sb.append("websites:"+websites);
		}else{
			sb.append("website:"+" ");
		}
		sb.append(";");
		sb.append("addressInfo:");
		if(addresses != null && addresses.size()>0){
			for (int i = 0; i < addresses.size(); i++) {
				sb.append("addressesInfo"+i+":");
				sb.append("add_street:"+addresses.get(i).getAddr_street());
				sb.append("-");
				sb.append("companyCity:"+addresses.get(i).getAddr_city());
				sb.append("-");
				sb.append("companyProvince:"+addresses.get(i).getAddr_province());
				sb.append("-");
				sb.append("companyPostal:"+addresses.get(i).getAddr_postal());
				sb.append(",");
			}
			sb.deleteCharAt(sb.length()-1);
		}else{
			sb.append("addressInfo: ");
		}
		sb.append(";");
		sb.append("companyInfo:");
		if(companies!=null && companies.size()>0){
			for (int i = 0; i < companies.size(); i++) {
				sb.append("company"+i+":");
				sb.append("companyName:"+companies.get(i).getCom_name());
				sb.append("-");
				sb.append("companyName:"+companies.get(i).getCom_job());
				sb.append(",");
			}
			sb.deleteCharAt(sb.length()-1);
		}else{
			sb.append("company: ");
		}
		sb.append("<<--");
		return sb.toString();
	}
}

class CCompany{
	private String com_name;
	private String com_job;
	public String getCom_name() {
		return com_name;
	}
	public void setCom_name(String com_name) {
		this.com_name = com_name;
	}
	public String getCom_job() {
		return com_job;
	}
	public void setCom_job(String com_job) {
		this.com_job = com_job;
	}
	
}

class CAddress{
	private String addr_street;
	private String addr_province;
	private String addr_city;
	private String addr_postal;
	public String getAddr_street() {
		return addr_street;
	}
	public void setAddr_street(String addr_street) {
		this.addr_street = addr_street;
	}
	public String getAddr_province() {
		return addr_province;
	}
	public void setAddr_province(String addr_province) {
		this.addr_province = addr_province;
	}
	public String getAddr_city() {
		return addr_city;
	}
	public void setAddr_city(String addr_city) {
		this.addr_city = addr_city;
	}
	public String getAddr_postal() {
		return addr_postal;
	}
	public void setAddr_postal(String addr_postal) {
		this.addr_postal = addr_postal;
	}
	
}
